var sex = 'm';

function updataContent() {
	var nickName = document.getElementById("nickName").value
		//昵称不可为空，如果跳过此页，后台在数据库中对昵称做处理
	if (!nickName) {
		mui.toast('昵称不可为空')
		return;
	}
	plus.nativeUI.showWaiting('正在提交');
	urlDd = getUrl("65noTokenaccount");
	var id = readData(localStorage.accountid);
	var signature = document.getElementById('qianMing').value;
	var trueName = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var address = document.getElementById('address').value;
	jsons = 'id=' + id +
		'&nickname=' + nickName +
		'&signature=' + signature +
		'&trueName=' + trueName +
		'&email=' + email +
		'&sex=' + sex +
		'&address=' + address;
	mui.ajax(urlDd, {
		data: jsons,
		dataType: 'json',
		type: 'post',
		timeout: 5000,
		success: function(data) {
			plus.nativeUI.closeWaiting();
			if (data.msg == 'success') {
				tishi();
				setTimeout(function() {
					//资料完善后，进入登录窗口，并关闭当前窗口
                   closeSelf();
				}, 100);
			} else {
				mui.toast('资料提交失败，请重试')
			}
		},
		error: function(xhr, type, errorThrown) {
			//异常处理；
			plus.nativeUI.closeWaiting();
			mui.toast('网络连接异常，请重试')
		}
	});
}

function tishi() {
	delete localStorage.accountid;
	mui.toast('恭喜注册完成，请重新登录');
}

function closeSelf() {
	setTimeout(function() {
		plus.webview.getWebviewById('completeInfoHead.html').close();
	}, 1000)
	mui.openWindow({
		url: "loginHead.html",
		id: "loginHead.html",
		waiting: {
			autoShow: false, //自动显示等待框，默认为true
		}
	})
}

function change(obj) {
	if (obj.id == "man") {
		sex = 'm';
	} else {
		sex = 'f';
	}
}